#!usr/bin/env python
import csv
from distutils.log import warn as printf

DATA = (
    (9, 'Web client and servers', 'base64'),
    (10, 'huhx', 'linux'),
    (12, 'liuling', 'name')
)

printf('***** WRIING CSV DATA')
f = open('../file/bookdata.csv', 'w')
writer = csv.writer(f)
for record in DATA:
    writer.writerow(record)
f.close()

printf('****** review of saved data')
f = open('../file/bookdata.csv', 'r')
reader = csv.reader(f)
for chap, title, modpkgs in reader:
    printf('chapter %s: %r %s' % (chap, title, modpkgs))
f.close()